package com.nbsaas.boot.controller.shop;

import com.nbsaas.boot.rest.response.ResponseObject;
import com.nbsaas.boot.shop.ext.apis.ShopConfigExtApi;
import com.nbsaas.boot.shop.ext.domain.config.WeChatOauth;
import com.nbsaas.boot.shop.ext.domain.config.WeChatPay;
import com.nbsaas.boot.utils.UserUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
*  对外控制器
*/
@RestController
@RequestMapping("/shopConfig")
public class ShopConfigController {


    @RequestMapping("/viewWeChatOauth")
    public ResponseObject<WeChatOauth> viewWeChatOauth() {
        return shopConfigExtApi.info(UserUtils.user().getShop(), WeChatOauth.class);
    }

    @RequestMapping("/configWeChatOauth")
    public ResponseObject<WeChatOauth> configWeChatOauth(WeChatOauth config) {
        return shopConfigExtApi.configData(UserUtils.user().getShop(), config);
    }

    @RequestMapping("/configWeChatPay")
    public ResponseObject<WeChatPay> configData( WeChatPay config) {
        return shopConfigExtApi.configData(UserUtils.user().getShop(), config);
    }

    @RequestMapping("/viewWeChatPay")
    public ResponseObject<WeChatPay> viewWeChatPay() {
        return shopConfigExtApi.info(UserUtils.user().getShop(), WeChatPay.class);
    }

    @Resource
    private ShopConfigExtApi shopConfigExtApi;


}